/*
 * Alexey Danchuk
 * This software is an implementation of the task from OOP module.
 */
package knowledgetestsystem;

/**
 * This class describes simple question type.
 * 
 * @version 2.03 10 February 2013
 * @author Alexey Danchuk
 */
class SimpleQuestion extends Question {
	/**
	 * This variable holds the correct answer to the question.
	 */
	private String[] correctAnswer;
	private static final int MAX_SCORE = 1;
	private static final int ZERO_SCORE = 0;

	public SimpleQuestion(final String questionText,
						  final String[] ansersText,
						  final String[] coorectAnsers) {
		super(questionText, ansersText);
		saveAnswer(coorectAnsers);
	}

	@Override
	protected int chekAnswer(final String[] userAnswers) {
		if (userAnswers.equals(correctAnswer)) {
			return MAX_SCORE;
		} else {
			return ZERO_SCORE;
		}
	}

	@Override
	protected void saveAnswer(final String[] answer) {
		correctAnswer = answer;
	}
}
